cmake_minimum_required(VERSION 3.10)

project(eew CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(webview REQUIRED)
find_package(Threads REQUIRED)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

file(GLOB_RECURSE SRC_CPP CONFIGURE_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp)
file(READ "${CMAKE_CURRENT_LIST_DIR}/src/index.html" HTML_CONTENT CONFIGURE_DEPENDS)

configure_file(
    ${CMAKE_CURRENT_LIST_DIR}/src/html_string.hpp.in
    ${CMAKE_CURRENT_LIST_DIR}/src/html_string.hpp
)
add_executable(${PROJECT_NAME} ${SRC_CPP})

if(WIN32)
    target_link_options(${PROJECT_NAME} PRIVATE -mwindows -static)
endif()

target_link_libraries(${PROJECT_NAME} PRIVATE webview::core Threads::Threads)